function exp_runtime_datasize_SLICE_HI()
    h=figure(1);
    runtimes_SLICE_HI=zeros(10,1);
    runtimes_SLICE2 =zeros(10,1);
    numpoints=zeros(10,1);
    for i=1:10
        numpoints(i)=i*100;
    end
    for i=1:10
        data=DATAF5C3(numpoints(i));
        runtimes_SLICE_HI(i)=TEST_SLICE_HI(data);
    end
    for i=1:10
        data=DATAF5C3(numpoints(i));
        runtimes_SLICE2(i)=TEST_SLICE2(data);
    end
    runtimes=[runtimes_SLICE_HI,runtimes_SLICE2];
    save('exp_runtime_datasize_SLICE_HI.mat','numpoints','runtimes');
    plot(numpoints, runtimes_SLICE_HI, 'b-+');
    hold on;
    plot(numpoints, runtimes_SLICE2, 'r-*');
    hold on;
    saveas(h, 'figure_exp_runtime_datasize_SLICE_HI.fig');
end

function runtime=TEST_SLICE_HI(data)
    tic;
    [corrplanes,corratts,sups]=SLICE_HI(data,1,0.000001,0.08);
    runtime=toc;
end

function runtime=TEST_SLICE2(data)
    runtime=0;
    [M,N]=size(data);
    for i=1:N
        localruntime=TEST_SLICE2_SUBSETS(data,[i]);
        runtime=runtime+localruntime;
    end
end

function [runtime]=TEST_SLICE2_SUBSETS(data, atts)
    [M,N]=size(data);
    subdata =zeros(M,length(atts));
    for i=1:length(atts)
        subdata(:,i)=data(:,atts(i));
    end
    tic;
    [corrplanes,sups]=SLICE2(data, 1, 0.000001, 0.08);
    runtime=toc;
    if length(atts)==N
        return;
    end
    for i=1:N
        if i<=max(atts)
            continue;
        end
        localtime=TEST_SLICE2_SUBSETS(data, [atts,i]);
        runtime=runtime+localtime;
    end
end

function data=DATAF5C3(numpoints)
    numpoints =int32(numpoints/4);
    noise_x=randint(1,numpoints,[-200,200]);
    noise_y=randint(1,numpoints,[-200,200]);
    noise_z=randint(1,numpoints,[-200,200]);
    noise_r=randint(1,numpoints,[-200,200]);
    noise_t=randint(1,numpoints,[-200,200]);
    
    x1=randint(1,numpoints,[-200,200]);
    y1=randint(1,numpoints,[-200,200]);
    z1=2*x1; % 2x1-x3=0
    r1=randint(1,numpoints,[-200,200]);
    t1=randint(1,numpoints,[-200,200]);
    
    x2=randint(1,numpoints,[-200,200]);
    y2=randint(1,numpoints,[-200,200]);
    z2=-y2*5+randn(1,numpoints); % 5x2+x3=0
    r2=randint(1,numpoints,[-200,200]);
    t2=randint(1,numpoints,[-200,200]);
    
    x3=randint(1,numpoints,[-200,200]);
    y3=randint(1,numpoints,[-200,200]);
    z3=-4*x3-2*y3+100+randn(1,numpoints)*4; % 4x1+2x2+x3=100
    r3=randint(1,numpoints,[-200,200]);
    t3=randint(1,numpoints,[-200,200]);
    
    x=[noise_x,x1,x2,x3];
    y=[noise_y,y1,y2,y3];
    z=[noise_z,z1,z2,z3];
    r=[noise_r,r1,r2,r3];
    t=[noise_t,t1,t2,t3];
    
    data=[ x',y',z',r',t'];
end
